
#include "material.h"


object::object(double w, double t, double l, material mat) 
		: baseobject(""),
		width(w/1000.0),
		length(l/1000.0),
		thickness(t/1000.0),
		m(mat)
{
}
void object::displaydata() const
{
	std::cout << " displaying data for item " << name << std::endl;
	std::cout << "width: " << width << " thickness: " << thickness << " length: " << length << std::endl
		<< "centroid: " << centroid() << std::endl 
		<< "moment of inertia: " << inertia() <<std::endl
		<< "cross section area: " << area() << std::endl << std::endl;
	std::cout << "material properties: " <<std::endl
		<< "Young's modulus: " << m.youngsmodulus << " density: " <<  m.density << std::endl;
}
double sqr (double v) 
{
	return v * v;
}

material createMaterial(double density, double youngsmodulus, double yield, double ultimate)
{
	material m = {density * 1000.0, youngsmodulus * 1.0e6, yield * 1.0e6, ultimate * 1.0e6};
	return m;
}
